define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'business.district_admin/index/district_id/'+districtId,
        add_url: 'business.district_admin/add',
        edit_url: 'business.district_admin/edit',
        delete_url: 'business.district_admin/delete',
        export_url: 'business.district_admin/export',
        modify_url: 'business.district_admin/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id'},
                    {field: 'name', title: 'name',select:false},
                    {field: 'user_id', title: 'user_id',select:false},
                    {field: 'nickname', title: 'nickname',select:false},
                    {field: 'phone', title: 'phone',fieldAlias: 'u.phone'},
                    {field: 'role', title: '角色',selectList:{1:'超管',2:'工作人员',3:'管理员'}},
                    {width: 100,field: 'status', title: '状态',templet: ea.table.switch,tips:'生效|禁用',selectList:{1:'生效',0:'禁用'}},
                    {width: 180,field: 'create_time', title: 'create_time'},
                    {width: 150, title: '操作', templet: ea.table.tool},
                ]],
				done: function (){
                    $(".layui-table-body>table>tbody>tr").each(function (index, val) {
                        $($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
                    });
                },

            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});